from PIL import Image
import numpy as np
import pandas as pd

import os
if __name__ == "__main__":
    imagePath = r"/Users/wangshuguan/Workplace/pythonUtil/aa.txt"
    t = pd.read_csv(imagePath,header=None, sep=',')
    print(t)
    n = np.array(t.values[0])
#     n.shape = (343*3,812*3,4)
    n.shape = (343,812,4)
    im = Image.fromarray(np.uint8(n))
    im.show()
    
#     n_n = np.array()
#     for x in 100:
#         n_n.ad
#     print(n[0:4])
#     fm = pd.DataFrame()
#     print(t.values)
#     print()
#     fm.contact(np.array(t.values[0][:4]))
#     print(fm)
#     for x in enumerate(t):
#         print(t)
#         fm.append(t)
#     fm.to_json(r"/Users/wangshuguan/Workplace/pythonUtil/aa1.txt")
    
    
    
#     imagePath2 = "/Users/wangshuguan/Workplace/pythonUtil/WechatIMG2.jpeg"
#     arr = np.array(Image.open(imagePath2))
# 
#     print(arr.shape)
#     print(arr[0])
#     print(arr[0][0])
#     basedir = os.path.dirname(imagePath)
#     newDir = f"{basedir}/aa"
#     if os.path.isdir(newDir) == False:
#         os.mkdir(newDir)
#     for file in iphoneFiles:
#         for x in range(1,4):
#             retainString = ""
#             if x > 1 :
#                 retainString = f"@{x}x"
#             image = Image.open(imagePath)
#             size = file[1]*x,file[1]*x
#             image.thumbnail(size)
#             image.save(f"{basedir}/aa/{file[0]}{retainString}.png")
#     print("生成完毕")